
#include "felippa_prism.hpp"

namespace neon
{
felippa_prism::felippa_prism(int const minimum_degree)
{
    switch (minimum_degree)
    {
        case 1:
        {
            m_degree = 1;
            m_weights = {1.0};
            m_coordinates = {{0, 1.0 / 3.0, 1.0 / 3.0, 0.0}};

            break;
        }
        case 2:
        case 3:
        {
            m_degree = 3;

            m_weights.resize(6, 1.0 / 6.0);

            m_coordinates = {{0, 0.16666666666666666, 0.6666666666666667, 0.5773502691896257},
                             {1, 0.6666666666666667, 0.16666666666666666, 0.5773502691896257},
                             {2, 0.16666666666666666, 0.16666666666666666, 0.5773502691896257},
                             {3, 0.16666666666666666, 0.6666666666666667, -0.5773502691896257},
                             {4, 0.6666666666666667, 0.16666666666666666, -0.5773502691896257},
                             {5, 0.16666666666666666, 0.16666666666666666, -0.5773502691896257}};

            break;
        }
        case 4:
        {
            m_degree = 4;

            m_weights = {0.06205044157722541,
                         0.06205044157722541,
                         0.06205044157722541,
                         0.06205044157722541,
                         0.06205044157722541,
                         0.06205044157722541,
                         0.03054215101536719,
                         0.03054215101536719,
                         0.03054215101536719,
                         0.03054215101536719,
                         0.03054215101536719,
                         0.03054215101536719,
                         0.09928070652356065,
                         0.09928070652356065,
                         0.09928070652356065,
                         0.0488674416245875,
                         0.0488674416245875,
                         0.0488674416245875};

            m_coordinates = {{0, 0.4459484909159649, 0.10810301816807022, 0.7745966692414834},
                             {1, 0.10810301816807022, 0.4459484909159649, 0.7745966692414834},
                             {2, 0.4459484909159649, 0.4459484909159649, 0.7745966692414834},
                             {3, 0.4459484909159649, 0.10810301816807022, -0.7745966692414834},
                             {4, 0.10810301816807022, 0.4459484909159649, -0.7745966692414834},
                             {5, 0.4459484909159649, 0.4459484909159649, -0.7745966692414834},
                             {6, 0.09157621350977073, 0.8168475729804585, 0.7745966692414834},
                             {7, 0.8168475729804585, 0.09157621350977073, 0.7745966692414834},
                             {8, 0.09157621350977073, 0.09157621350977073, 0.7745966692414834},
                             {9, 0.09157621350977073, 0.8168475729804585, -0.7745966692414834},
                             {10, 0.8168475729804585, 0.09157621350977073, -0.7745966692414834},
                             {11, 0.09157621350977073, 0.09157621350977073, -0.7745966692414834},
                             {12, 0.4459484909159649, 0.10810301816807022, 0.0},
                             {13, 0.10810301816807022, 0.4459484909159649, 0.0},
                             {14, 0.4459484909159649, 0.4459484909159649, 0.0},
                             {15, 0.09157621350977073, 0.8168475729804585, 0.0},
                             {16, 0.8168475729804585, 0.09157621350977073, 0.0},
                             {17, 0.09157621350977073, 0.09157621350977073, 0.0}};
            break;
        }
        case 5:
        {
            m_degree = 5;
            m_weights = {0.03498310570689643,
                         0.03498310570689643,
                         0.03498310570689643,
                         0.03498310570689643,
                         0.03498310570689643,
                         0.03498310570689643,
                         0.03677615355236283,
                         0.03677615355236283,
                         0.03677615355236283,
                         0.03677615355236283,
                         0.03677615355236283,
                         0.03677615355236283,
                         0.0625,
                         0.0625,
                         0.05597296913103428,
                         0.05597296913103428,
                         0.05597296913103428,
                         0.05884184568378053,
                         0.05884184568378053,
                         0.05884184568378053,
                         0.1};

            m_coordinates = {{0, 0.10128650732345633, 0.7974269853530873, 0.7745966692414834},
                             {1, 0.7974269853530873, 0.10128650732345633, 0.7745966692414834},
                             {2, 0.10128650732345633, 0.10128650732345633, 0.7745966692414834},
                             {3, 0.10128650732345633, 0.7974269853530873, -0.7745966692414834},
                             {4, 0.7974269853530873, 0.10128650732345633, -0.7745966692414834},
                             {5, 0.10128650732345633, 0.10128650732345633, -0.7745966692414834},
                             {6, 0.47014206410511505, 0.05971587178976989, 0.7745966692414834},
                             {7, 0.05971587178976989, 0.47014206410511505, 0.7745966692414834},
                             {8, 0.47014206410511505, 0.47014206410511505, 0.7745966692414834},
                             {9, 0.47014206410511505, 0.05971587178976989, -0.7745966692414834},
                             {10, 0.05971587178976989, 0.47014206410511505, -0.7745966692414834},
                             {11, 0.47014206410511505, 0.47014206410511505, -0.7745966692414834},
                             {12, 0.3333333333333333, 0.3333333333333333, 0.7745966692414834},
                             {13, 0.3333333333333333, 0.3333333333333333, -0.7745966692414834},
                             {14, 0.10128650732345633, 0.7974269853530873, 0.0},
                             {15, 0.7974269853530873, 0.10128650732345633, 0.0},
                             {16, 0.10128650732345633, 0.10128650732345633, 0.0},
                             {17, 0.47014206410511505, 0.05971587178976989, 0.0},
                             {18, 0.05971587178976989, 0.47014206410511505, 0.0},
                             {19, 0.47014206410511505, 0.47014206410511505, 0.0},
                             {20, 0.3333333333333333, 0.3333333333333333, 0.0}};
            break;
        }
        case 6:
        {
            m_degree = 6;

            m_weights = {0.008843323515718317, 0.008843323515718317, 0.008843323515718317,
                         0.008843323515718317, 0.008843323515718317, 0.008843323515718317,
                         0.02031233592848984,  0.02031233592848984,  0.02031233592848984,
                         0.02031233592848984,  0.02031233592848984,  0.02031233592848984,
                         0.01441007403935041,  0.01441007403935041,  0.01441007403935041,
                         0.01441007403935041,  0.01441007403935041,  0.01441007403935041,
                         0.01441007403935041,  0.01441007403935041,  0.01441007403935041,
                         0.01441007403935041,  0.01441007403935041,  0.01441007403935041,
                         0.01657912966938509,  0.01657912966938509,  0.01657912966938509,
                         0.01657912966938509,  0.01657912966938509,  0.01657912966938509,
                         0.03808080193469984,  0.03808080193469984,  0.03808080193469984,
                         0.03808080193469984,  0.03808080193469984,  0.03808080193469984,
                         0.02701546376983638,  0.02701546376983638,  0.02701546376983638,
                         0.02701546376983638,  0.02701546376983638,  0.02701546376983638,
                         0.02701546376983638,  0.02701546376983638,  0.02701546376983638,
                         0.02701546376983638,  0.02701546376983638,  0.02701546376983638};

            m_coordinates = {{0, 0.06308901449150223, 0.8738219710169955, -0.8611363115940526},
                             {1, 0.8738219710169955, 0.06308901449150223, -0.8611363115940526},
                             {2, 0.06308901449150223, 0.06308901449150223, -0.8611363115940526},
                             {3, 0.06308901449150223, 0.8738219710169955, 0.8611363115940526},
                             {4, 0.8738219710169955, 0.06308901449150223, 0.8611363115940526},
                             {5, 0.06308901449150223, 0.06308901449150223, 0.8611363115940526},
                             {6, 0.2492867451709104, 0.5014265096581791, -0.8611363115940526},
                             {7, 0.5014265096581791, 0.2492867451709104, -0.8611363115940526},
                             {8, 0.2492867451709104, 0.2492867451709104, -0.8611363115940526},
                             {9, 0.2492867451709104, 0.5014265096581791, 0.8611363115940526},
                             {10, 0.5014265096581791, 0.2492867451709104, 0.8611363115940526},
                             {11, 0.2492867451709104, 0.2492867451709104, 0.8611363115940526},
                             {12, 0.3103524510337844, 0.6365024991213987, 0.8611363115940526},
                             {13, 0.05314504984481695, 0.3103524510337844, 0.8611363115940526},
                             {14, 0.6365024991213987, 0.05314504984481695, 0.8611363115940526},
                             {15, 0.6365024991213987, 0.3103524510337844, 0.8611363115940526},
                             {16, 0.05314504984481695, 0.6365024991213987, 0.8611363115940526},
                             {17, 0.3103524510337844, 0.05314504984481695, 0.8611363115940526},
                             {18, 0.3103524510337844, 0.6365024991213987, -0.8611363115940526},
                             {19, 0.05314504984481695, 0.3103524510337844, -0.8611363115940526},
                             {20, 0.6365024991213987, 0.05314504984481695, -0.8611363115940526},
                             {21, 0.6365024991213987, 0.3103524510337844, -0.8611363115940526},
                             {22, 0.05314504984481695, 0.6365024991213987, -0.8611363115940526},
                             {23, 0.3103524510337844, 0.05314504984481695, -0.8611363115940526},
                             {24, 0.06308901449150223, 0.8738219710169955, 0.3399810435848563},
                             {25, 0.8738219710169955, 0.06308901449150223, 0.3399810435848563},
                             {26, 0.06308901449150223, 0.06308901449150223, 0.3399810435848563},
                             {27, 0.06308901449150223, 0.8738219710169955, -0.3399810435848563},
                             {28, 0.8738219710169955, 0.06308901449150223, -0.3399810435848563},
                             {29, 0.06308901449150223, 0.06308901449150223, -0.3399810435848563},
                             {30, 0.2492867451709104, 0.5014265096581791, 0.3399810435848563},
                             {31, 0.5014265096581791, 0.2492867451709104, 0.3399810435848563},
                             {32, 0.2492867451709104, 0.2492867451709104, 0.3399810435848563},
                             {33, 0.2492867451709104, 0.5014265096581791, -0.3399810435848563},
                             {34, 0.5014265096581791, 0.2492867451709104, -0.3399810435848563},
                             {35, 0.2492867451709104, 0.2492867451709104, -0.3399810435848563},
                             {36, 0.3103524510337844, 0.6365024991213987, 0.3399810435848563},
                             {37, 0.05314504984481695, 0.3103524510337844, 0.3399810435848563},
                             {38, 0.6365024991213987, 0.05314504984481695, 0.3399810435848563},
                             {39, 0.6365024991213987, 0.3103524510337844, 0.3399810435848563},
                             {40, 0.05314504984481695, 0.6365024991213987, 0.3399810435848563},
                             {41, 0.3103524510337844, 0.05314504984481695, 0.3399810435848563},
                             {42, 0.3103524510337844, 0.6365024991213987, -0.3399810435848563},
                             {43, 0.05314504984481695, 0.3103524510337844, -0.3399810435848563},
                             {44, 0.6365024991213987, 0.05314504984481695, -0.3399810435848563},
                             {45, 0.6365024991213987, 0.3103524510337844, -0.3399810435848563},
                             {46, 0.05314504984481695, 0.6365024991213987, -0.3399810435848563},
                             {47, 0.3103524510337844, 0.05314504984481695, -0.3399810435848563}};
            break;
        }
        default:
        {
            throw std::domain_error("This is not the quadrature scheme you are looking for");
        }
    }
}
}
